Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not panic on attempting to force-close a subchannel #151

Conversation

klochowicz
Copy link
Collaborator

We have run into this in our public regtest setup, it seems logging an error instead of panicking is safest, as at least it won't bring down the whole app (and it will instead spam the logs).

this is just a quickfix and will not solve the underlying issue.

@Tibo-lg there's come code commented out there - I assume you had some reasons to not try to keep it as is - therefore before jumping into trying to fix this issue properly, I'd like to hear your opinion if you had something in mind :)

@klochowicz klochowicz self-assigned this Sep 20, 2023
Copy link
Contributor

@Tibo-lg Tibo-lg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your fix is fine. IIRC originally this path could never be hit, but probably due to changes in the way the periodic_check is implemented it does now. What the proper fix is is a bit of an open question, last time we discussed about that there was no really conclusion. For the "regular" DLC channel force closing in case of a non responsive peer during channel establishment/update make sense to me, but it might not be the best for the DLC/LN ones.

(Note the target branch is not the "main" ln/dlc one, not sure if that's on purpose)

klochowicz added a commit to get10101/10101 that referenced this pull request Sep 21, 2023
…-closure attempt

We've run into `unimplemented!` block in rust-dlc in our regtest setup.
In order to unblock the regtest environment, this quickfix logs an error and
continues instead of panicking.

See: p2pderivatives/rust-dlc#151
@klochowicz klochowicz changed the base branch from feature/ln-dlc-channels-10101 to feature/ln-dlc-channels September 21, 2023 00:46
We have run into this in production, it seems logging an error instead of
panicking is safest.
@klochowicz klochowicz force-pushed the fix/do-not-panic-on-subchannel-force-closure branch from ff3eae8 to 6775c53 Compare September 21, 2023 00:57
@klochowicz
Copy link
Collaborator Author

I think your fix is fine. IIRC originally this path could never be hit, but probably due to changes in the way the periodic_check is implemented it does now. What the proper fix is is a bit of an open question, last time we discussed about that there was no really conclusion. For the "regular" DLC channel force closing in case of a non responsive peer during channel establishment/update make sense to me, but it might not be the best for the DLC/LN ones.

(Note the target branch is not the "main" ln/dlc one, not sure if that's on purpose)

thank you for your feedback, I've retargeted this PR into the "main" ln/dlc one (feature/ln-dlc-channels I believe?) and also pushed directly into our branch so we can get unstuck.

I wonder whether I should log an error or just ignore the subchannel instead of an error if it will become more frequent 🤔 - for now I'll deploy it and see how it behaves.

klochowicz added a commit to get10101/10101 that referenced this pull request Sep 21, 2023
…-closure attempt

We've run into `unimplemented!` block in rust-dlc in our regtest setup.
In order to unblock the regtest environment, this quickfix logs an error and
continues instead of panicking.

See: p2pderivatives/rust-dlc#151
@Tibo-lg
Copy link
Contributor

Tibo-lg commented Sep 21, 2023

I think your fix is fine. IIRC originally this path could never be hit, but probably due to changes in the way the periodic_check is implemented it does now. What the proper fix is is a bit of an open question, last time we discussed about that there was no really conclusion. For the "regular" DLC channel force closing in case of a non responsive peer during channel establishment/update make sense to me, but it might not be the best for the DLC/LN ones.
(Note the target branch is not the "main" ln/dlc one, not sure if that's on purpose)

thank you for your feedback, I've retargeted this PR into the "main" ln/dlc one (feature/ln-dlc-channels I believe?) and also pushed directly into our branch so we can get unstuck.

I wonder whether I should log an error or just ignore the subchannel instead of an error if it will become more frequent 🤔 - for now I'll deploy it and see how it behaves.

Yeah I agree maybe warn or info level could be enough (or not having a log at all would also be fine, depends if you think the info is useful or not).

Also you can cherry pick this commit to fix clipppy: ecbc386 (might not apply perfectly though since it's for the master branch which doesn't have sub channels).

@@ -129,7 +129,10 @@ macro_rules! check_for_timed_out_channels {
let is_timed_out = timeout < $manager.time.unix_time_now();
if is_timed_out {
let sub_channel = if channel.is_sub_channel() {
unimplemented!();
error!("Force-closing subchannels is not supported; skipping closure.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be more precise, what's not supported is force-closing timed out subchannels, but AFAIK we could force-close here if we wanted to.

In 10101 we probably want more control over triggering a force-close, so I think we just don't want to call check_for_timed_out_channels at all. I wonder if this feature of the library is actually useful for any consumer, since force-closing is often an expensive decision cc @Tibo-lg. AFAIK this timeout is not based on the refund timelock, so we're being overeager.

I agree with removing the unimplemented, but I would maybe just log on Debug or nothing at all.

@luckysori
Copy link
Collaborator

Superseded by #159.

@luckysori luckysori closed this Oct 24, 2023
@luckysori luckysori added the ln label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants